﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;
using Newtonsoft.Json;
using WeiSha.Core.Param.Method;
using WeiSha.Core.Parameters.Authorization;

namespace WeiSha.Core
{
	// Token: 0x0200001D RID: 29
	public class License
	{
		// Token: 0x1700002B RID: 43
		// (get) Token: 0x060000A3 RID: 163 RVA: 0x00005958 File Offset: 0x00003B58
		public string Edition
		{
			get
			{
				string edition = WeiSha.Core.Parameters.Authorization.Edition.GetEdition(this.EdtionLevel);
				bool flag = this.EdtionLevel < 6;
				string text;
				if (flag)
				{
					text = edition;
				}
				else
				{
					text = Copyright.Value("edition");
				}
				return text;
			}
		}

		// Token: 0x1700002C RID: 44
		// (get) Token: 0x060000A4 RID: 164 RVA: 0x00005994 File Offset: 0x00003B94
		public string Label
		{
			get
			{
				string label = WeiSha.Core.Parameters.Authorization.Edition.GetLabel(this.EdtionLevel);
				bool flag = this.EdtionLevel < 6;
				string text;
				if (flag)
				{
					text = label;
				}
				else
				{
					text = Copyright.Value("label");
				}
				return text;
			}
		}

		// Token: 0x1700002D RID: 45
		// (get) Token: 0x060000A5 RID: 165 RVA: 0x000059D0 File Offset: 0x00003BD0
		public double FreeTime
		{
			get
			{
				return (this.InitTime.AddHours((double)this._freeTime) > DateTime.Now) ? (this.InitTime.AddHours((double)this._freeTime) - DateTime.Now).TotalHours : 0.0;
			}
		}

		// Token: 0x1700002E RID: 46
		// (get) Token: 0x060000A6 RID: 166 RVA: 0x00005A30 File Offset: 0x00003C30
		// (set) Token: 0x060000A7 RID: 167 RVA: 0x00005A38 File Offset: 0x00003C38
		public DateTime StartTime { get; private set; }

		// Token: 0x1700002F RID: 47
		// (get) Token: 0x060000A8 RID: 168 RVA: 0x00005A41 File Offset: 0x00003C41
		// (set) Token: 0x060000A9 RID: 169 RVA: 0x00005A49 File Offset: 0x00003C49
		public DateTime EndTime { get; private set; }

		// Token: 0x17000030 RID: 48
		// (get) Token: 0x060000AA RID: 170 RVA: 0x00005A52 File Offset: 0x00003C52
		// (set) Token: 0x060000AB RID: 171 RVA: 0x00005A5A File Offset: 0x00003C5A
		public string Serial { get; private set; }

		// Token: 0x17000031 RID: 49
		// (get) Token: 0x060000AC RID: 172 RVA: 0x00005A63 File Offset: 0x00003C63
		// (set) Token: 0x060000AD RID: 173 RVA: 0x00005A6B File Offset: 0x00003C6B
		public string Port { get; private set; }

		// Token: 0x17000032 RID: 50
		// (get) Token: 0x060000AE RID: 174 RVA: 0x00005A74 File Offset: 0x00003C74
		// (set) Token: 0x060000AF RID: 175 RVA: 0x00005A7C File Offset: 0x00003C7C
		public bool IsApply { get; private set; }

		// Token: 0x17000033 RID: 51
		// (get) Token: 0x060000B0 RID: 176 RVA: 0x00005A88 File Offset: 0x00003C88
		public bool IsPass
		{
			get
			{
				bool isLocalIP = Server.IsLocalIP;
				bool flag;
				if (isLocalIP)
				{
					flag = true;
				}
				else
				{
					bool flag2 = DateTime.Now < this.InitTime.AddHours((double)this._freeTime);
					bool flag3 = flag2 || this.IsLicense;
					flag = flag3;
				}
				return flag;
			}
		}

		// Token: 0x17000034 RID: 52
		// (get) Token: 0x060000B1 RID: 177 RVA: 0x00005ADC File Offset: 0x00003CDC
		public bool IsLicense
		{
			get
			{
				bool flag = this.EdtionLevel == 0;
				bool flag2;
				if (flag)
				{
					flag2 = false;
				}
				else
				{
					bool flag3 = License._p.Type == ActivationType.Domain;
					if (flag3)
					{
						bool flag4 = License._p.Serial + ":" + License._p.Port != Server.Domain + ":" + Server.Port;
						if (flag4)
						{
							return false;
						}
					}
					bool flag5 = License._p.Type == ActivationType.IP;
					if (flag5)
					{
						bool flag6 = License._p.Serial + ":" + License._p.Port != Server.IP + ":" + Server.Port;
						if (flag6)
						{
							return false;
						}
					}
					flag2 = DateTime.Now > this.StartTime && DateTime.Now < this.EndTime.AddDays(1.0);
				}
				return flag2;
			}
		}

		// Token: 0x17000035 RID: 53
		// (get) Token: 0x060000B2 RID: 178 RVA: 0x00005BE4 File Offset: 0x00003DE4
		// (set) Token: 0x060000B3 RID: 179 RVA: 0x00005BEC File Offset: 0x00003DEC
		private string _licenseString { get; set; }

		// Token: 0x17000036 RID: 54
		// (get) Token: 0x060000B4 RID: 180 RVA: 0x00005BF5 File Offset: 0x00003DF5
		// (set) Token: 0x060000B5 RID: 181 RVA: 0x00005BFD File Offset: 0x00003DFD
		public ActivationType Type { get; private set; }

		// Token: 0x17000037 RID: 55
		// (get) Token: 0x060000B6 RID: 182 RVA: 0x00005C06 File Offset: 0x00003E06
		// (set) Token: 0x060000B7 RID: 183 RVA: 0x00005C0E File Offset: 0x00003E0E
		public int EdtionLevel { get; private set; }

		// Token: 0x060000B8 RID: 184 RVA: 0x00005C18 File Offset: 0x00003E18
		public int GetLimitCount(string field)
		{
			Edition item = WeiSha.Core.Parameters.Authorization.Edition.GetItem(this.EdtionLevel);
			bool flag = this.EdtionLevel == WeiSha.Core.Parameters.Authorization.Edition.Items.Length - 1;
			if (flag)
			{
				item.Organization = ((this._orgnum > 0) ? this._orgnum : item.Organization);
			}
			return item.GetLimitCount(field);
		}

		// Token: 0x17000038 RID: 56
		// (get) Token: 0x060000B9 RID: 185 RVA: 0x00005C70 File Offset: 0x00003E70
		public IDictionary<string, int> LimitItems
		{
			get
			{
				return WeiSha.Core.Parameters.Authorization.Edition.DataItemsChinese(this.EdtionLevel);
			}
		}

		// Token: 0x17000039 RID: 57
		// (get) Token: 0x060000BA RID: 186 RVA: 0x00005C7D File Offset: 0x00003E7D
		// (set) Token: 0x060000BB RID: 187 RVA: 0x00005C85 File Offset: 0x00003E85
		public string ServerDomain { get; set; }

		// Token: 0x1700003A RID: 58
		// (get) Token: 0x060000BC RID: 188 RVA: 0x00005C8E File Offset: 0x00003E8E
		// (set) Token: 0x060000BD RID: 189 RVA: 0x00005C96 File Offset: 0x00003E96
		public string ServerPort { get; set; }

		// Token: 0x1700003B RID: 59
		// (get) Token: 0x060000BE RID: 190 RVA: 0x00005C9F File Offset: 0x00003E9F
		// (set) Token: 0x060000BF RID: 191 RVA: 0x00005CA7 File Offset: 0x00003EA7
		public DateTime DeployTime { get; private set; }

		// Token: 0x1700003C RID: 60
		// (get) Token: 0x060000C0 RID: 192 RVA: 0x00005CB0 File Offset: 0x00003EB0
		public DateTime InitTime
		{
			get
			{
				return Server.InitDateTime;
			}
		}

		// Token: 0x1700003D RID: 61
		// (get) Token: 0x060000C1 RID: 193 RVA: 0x00005CB7 File Offset: 0x00003EB7
		public TimeSpan RunTime
		{
			get
			{
				return DateTime.Now - this.InitTime;
			}
		}

		// Token: 0x1700003E RID: 62
		// (get) Token: 0x060000C2 RID: 194 RVA: 0x00005CC9 File Offset: 0x00003EC9
		public int Trial
		{
			get
			{
				return App.Span;
			}
		}

		// Token: 0x1700003F RID: 63
		// (get) Token: 0x060000C3 RID: 195 RVA: 0x00005CD0 File Offset: 0x00003ED0
		// (set) Token: 0x060000C4 RID: 196 RVA: 0x00005CD8 File Offset: 0x00003ED8
		public DateTime AnalysisTime { get; private set; }

		// Token: 0x17000040 RID: 64
		// (get) Token: 0x060000C5 RID: 197 RVA: 0x00005CE1 File Offset: 0x00003EE1
		// (set) Token: 0x060000C6 RID: 198 RVA: 0x00005CE9 File Offset: 0x00003EE9
		public bool IsAnalysis { get; private set; }

		// Token: 0x17000041 RID: 65
		// (get) Token: 0x060000C7 RID: 199 RVA: 0x00005CF2 File Offset: 0x00003EF2
		public string[] LimitDomain
		{
			get
			{
				return WeiSha.Core.Parameters.Authorization.Edition.Domain;
			}
		}

		// Token: 0x17000042 RID: 66
		// (get) Token: 0x060000C8 RID: 200 RVA: 0x00005CFC File Offset: 0x00003EFC
		public string FullText
		{
			get
			{
				bool flag = !this.IsLicense;
				string text;
				if (flag)
				{
					text = string.Empty;
				}
				else
				{
					StringBuilder stringBuilder = new StringBuilder();
					stringBuilder.AppendLine("");
					stringBuilder.AppendLine("软件名称：" + App.DetailGet("产品名称"));
					stringBuilder.AppendLine("软件版本：" + App.DetailGet("版本号"));
					stringBuilder.AppendLine("版本名称：" + this.Edition);
					bool flag2 = this.Type == ActivationType.CPU || this.Type == ActivationType.HardDisk;
					if (flag2)
					{
						stringBuilder.AppendLine("授权对象：" + this.Serial);
					}
					else
					{
						stringBuilder.AppendLine("授权对象：" + this.Serial + ":" + this.Port);
					}
					stringBuilder.AppendLine("授权类型：" + this.Type.ToString());
					stringBuilder.AppendLine("起始时间：" + this.StartTime.ToString("yyyy年MM月dd日"));
					stringBuilder.AppendLine("结束时间：" + this.EndTime.ToString("yyyy年MM月dd日"));
					stringBuilder.AppendLine("");
					string text2 = "================WEISHAKEJI_LICENSE================";
					stringBuilder.AppendLine(text2);
					int num = 0;
					while (text2.Length * num < this._licenseString.Length)
					{
						int num2 = (((num + 1) * text2.Length < this._licenseString.Length) ? text2.Length : (this._licenseString.Length % text2.Length));
						string text3 = this._licenseString.Substring(num * text2.Length, num2);
						stringBuilder.AppendLine(text3);
						num++;
					}
					text = stringBuilder.ToString();
				}
				return text;
			}
		}

		// Token: 0x17000043 RID: 67
		// (get) Token: 0x060000C9 RID: 201 RVA: 0x00005EE8 File Offset: 0x000040E8
		[JsonIgnore]
		public static License Value
		{
			get
			{
				bool flag = License._p == null;
				if (flag)
				{
					object syncLock = License._syncLock;
					lock (syncLock)
					{
						License._p = new License(true);
					}
				}
				bool flag3 = !License._p.IsAnalysis || License._p.EdtionLevel == 0;
				if (flag3)
				{
					License._p.Init();
				}
				return License._p;
			}
		}

		// Token: 0x060000CA RID: 202 RVA: 0x00005F74 File Offset: 0x00004174
		public License()
		{
			this.DeployTime = this._readDeployTime();
			bool flag = !this._initLocalLicense();
			if (flag)
			{
				Thread thread = new Thread(new ThreadStart(this._initOnlineLicense));
				thread.Start();
			}
		}

		// Token: 0x060000CB RID: 203 RVA: 0x00005FD4 File Offset: 0x000041D4
		private License(bool isinit)
		{
			this.DeployTime = this._readDeployTime();
			bool flag = !isinit;
			if (!flag)
			{
				bool flag2 = !this._initLocalLicense();
				if (flag2)
				{
					Thread thread = new Thread(new ThreadStart(this._initOnlineLicense));
					thread.Start();
				}
			}
		}

		// Token: 0x17000044 RID: 68
		// (get) Token: 0x060000CC RID: 204 RVA: 0x00006040 File Offset: 0x00004240
		private List<string> FileDependencies
		{
			get
			{
				List<string> list = new List<string>();
				foreach (string text in Directory.GetFiles(Server.ProgramPath, "license*.*"))
				{
					list.Add(text);
				}
				this._fileDependencies = list;
				return this._fileDependencies;
			}
		}

		// Token: 0x060000CD RID: 205 RVA: 0x00006094 File Offset: 0x00004294
		public void Init()
		{
			bool flag = this._initLocalLicense();
			bool flag2 = !flag;
			if (flag2)
			{
				new Thread(new ThreadStart(this._initOnlineLicense)).Start();
			}
		}

		// Token: 0x060000CE RID: 206 RVA: 0x000060C8 File Offset: 0x000042C8
		private bool _initLocalLicense()
		{
			string text = Server.ProgramPath + "license.weisha";
			bool flag = !File.Exists(text);
			if (flag)
			{
				text = Server.ProgramPath + "license.txt";
			}
			bool flag2 = File.Exists(text);
			if (flag2)
			{
				using (StreamReader streamReader = new StreamReader(text, Encoding.Default))
				{
					this._licenseString = streamReader.ReadToEnd();
				}
			}
			else
			{
				this._licenseString = string.Empty;
            }
            bool flag3 = !string.IsNullOrWhiteSpace(this._licenseString);
			if (flag3)
			{
				bool flag4 = this._licenseString.IndexOf("=") > -1 && this._licenseString.Length > 0;
				if (flag4)
				{
					this._licenseString = this._licenseString.Substring(this._licenseString.LastIndexOf("=") + 1);
				}
				this._licenseString = Regex.Replace(this._licenseString, "\\D", "", RegexOptions.Singleline);
			}
			bool flag5 = string.IsNullOrEmpty(this._licenseString);
			bool flag6;
            if (flag5)
			{
				this.EdtionLevel = 0;
				flag6 = false;
			}
			else
			{
				string text2 = this._decrypt(this._licenseString);
                try
				{
					flag6 = this._SetInitValue(text2);
				}
				catch (Exception ex)
				{
					Log.Error(base.GetType().FullName, ex);
					flag6 = false;
				}
			}
			return flag6;
		}

		// Token: 0x060000CF RID: 207 RVA: 0x0000623C File Offset: 0x0000443C
		private void _initOnlineLicense()
		{
			bool flag = (DateTime.Now - this.AnalysisTime).TotalSeconds < 600.0;
			if (!flag)
			{
				this.AnalysisTime = DateTime.Now;
				bool isApply = this.IsApply;
				if (!isApply)
				{
					bool flag2 = string.IsNullOrEmpty(this.ServerDomain) || this.ServerDomain.Equals("localhost", StringComparison.OrdinalIgnoreCase) || this.ServerDomain.Equals("127.0.0.1", StringComparison.OrdinalIgnoreCase);
					if (!flag2)
					{
						this.IsApply = true;
						string text = "aHR0cDovL0xpY2Vuc2Uud2Vpc2hha2VqaS5uZXQvTGljLw==";
						text = Encoding.Default.GetString(Convert.FromBase64String(text));
						string text2 = string.Format("code={0}&key={1}", this.activationcode(), App.Key);
						byte[] bytes = Encoding.UTF8.GetBytes(text2);
						try
						{
							byte[] array = new WebClient
							{
								Headers = { { "Content-Type", "application/x-www-form-urlencoded" } }
							}.UploadData(text, "POST", bytes);
							string @string = Encoding.UTF8.GetString(array);
							bool flag3 = @string == "-1";
							if (flag3)
							{
								this.IsApply = false;
							}
							else
							{
								string text3 = this._decrypt(@string);
								bool flag4 = this._SetInitValue(text3);
								bool flag5 = flag4;
								if (flag5)
								{
									this.DeployTime = DateTime.Now;
								}
							}
						}
						catch
						{
							this.IsApply = false;
						}
					}
				}
			}
		}

		// Token: 0x060000D0 RID: 208 RVA: 0x000063B8 File Offset: 0x000045B8
		private string activationcode()
		{
			string text = this.ServerDomain;
			bool flag = string.IsNullOrWhiteSpace(text);
			string text2;
			if (flag)
			{
				text2 = "";
			}
			else
			{
				text = text + ":" + this.ServerPort;
				text2 = Activationcode.RegistCode(4, text);
			}
			return text2;
		}

		// Token: 0x060000D1 RID: 209 RVA: 0x000063FC File Offset: 0x000045FC
		private string _decrypt(string licenseString)
		{
			string text = this.DecryptForAscii(licenseString);
			bool flag = string.IsNullOrEmpty(text);
			string text2;
			if (flag)
			{
				text2 = "";
			}
			else
			{
				int num = 0;
				int.TryParse(text.Substring(0, 1), out num);
				this.Type = (ActivationType)num;
                string text3 = text.Substring(1);
				string decryptKey = this.GetDecryptKey(this.Type);
                text3 = this.DecryptForDES(text3, decryptKey);
                bool flag2 = string.IsNullOrEmpty(text3);
				if (flag2)
				{
					text2 = "";
				}
				else
				{
					text2 = text3;
				}
			}
			return text2;
		}

		// Token: 0x060000D2 RID: 210 RVA: 0x0000647C File Offset: 0x0000467C
		private string DecryptForAscii(string ascii)
		{
			string text;
			try
			{
				byte[] array = new byte[ascii.Length / 4];
				for (int i = 0; i < ascii.Length; i += 4)
				{
					array[i / 4] = (byte)(Convert.ToInt32(ascii.Substring(i, 4)) ^ 15);
				}
				text = Encoding.ASCII.GetString(array);
			}
			catch
			{
				text = null;
			}
			return text;
		}

		// Token: 0x060000D3 RID: 211 RVA: 0x000064EC File Offset: 0x000046EC
		private string DecryptForDES(string decryptStr, string decryptKey)
		{
			string text;
			try
			{
				byte[] array = new byte[] { 18, 52, 86, 120, 144, 171, 205, 239 };
				byte[] array2 = new byte[decryptStr.Length];
				byte[] bytes = Encoding.UTF8.GetBytes(decryptKey);
				DESCryptoServiceProvider descryptoServiceProvider = new DESCryptoServiceProvider();
				array2 = Convert.FromBase64String(decryptStr);
				MemoryStream memoryStream = new MemoryStream();
				CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateDecryptor(bytes, array), CryptoStreamMode.Write);
				cryptoStream.Write(array2, 0, array2.Length);
				cryptoStream.FlushFinalBlock();
				Encoding encoding = new UTF8Encoding();
				text = encoding.GetString(memoryStream.ToArray());
			}
			catch
			{
				text = null;
			}
			return text;
		}

		// Token: 0x060000D4 RID: 212 RVA: 0x00006594 File Offset: 0x00004794
		private string GetDecryptKey(ActivationType type)
		{
			string text;
			switch (type)
			{
			case ActivationType.CPU:
				text = Server.CPU_ID;
				break;
			case ActivationType.HardDisk:
				text = Server.HardDiskID;
				break;
			case ActivationType.IP:
				text = Server.IP;
				text = text + ":" + Server.Port;
				break;
			case ActivationType.Domain:
				text = Server.Domain;
				text = text + ":" + Server.Port;
				break;
			case ActivationType.Root:
				text = Server.MainName;
				text = text + ":" + Server.Port;
				break;
			default:
				text = Server.Domain;
				text = text + ":" + Server.Port;
				break;
			}
			text = text + Platform.Name + Platform.Version;
			while (text.Length < 8)
			{
				text += text;
			}
			text = new ConvertToAnyValue(text).MD5;
            bool flag = text.Length > 8;
			if (flag)
			{
				text = text.Substring(0, 8);
			}
			return text;
		}

		// Token: 0x060000D5 RID: 213 RVA: 0x00006694 File Offset: 0x00004894
		private bool _SetInitValue(string licenseString)
		{
			bool flag = false;
			string[] array = (string.IsNullOrWhiteSpace(licenseString) ? null : licenseString.Split(new char[] { ';' }));
			bool flag2 = array == null || array.Length <= 1;
			if (flag2)
			{
				this.EdtionLevel = 0;
				this.StartTime = DateTime.MinValue;
				this.EndTime = DateTime.MaxValue.AddYears(-1);
				this.Type = ActivationType.IP;
				this.Serial = Server.IP;
				this.Port = Server.Port;
			}
			else
			{
				this.Serial = array[1];
				bool flag3 = this.Type == ActivationType.Domain || this.Type == ActivationType.IP || this.Type == ActivationType.Root;
				if (flag3)
				{
					bool flag4 = this.Serial.Length > 0 && this.Serial.IndexOf(":") > -1;
					if (flag4)
					{
						bool flag5 = !this.Serial.EndsWith(":");
						if (flag5)
						{
							this.Port = this.Serial.Substring(this.Serial.LastIndexOf(":") + 1);
						}
						bool flag6 = !this.Serial.StartsWith(":");
						if (flag6)
						{
							this.Serial = this.Serial.Substring(0, this.Serial.LastIndexOf(":"));
						}
					}
				}
				this.StartTime = Convert.ToDateTime(array[2]);
				this.EndTime = Convert.ToDateTime(array[3]);
				int num;
				int.TryParse(array[4], out num);
				this.EdtionLevel = ((num <= 1) ? 1 : num);
				flag = DateTime.Now > this.StartTime && DateTime.Now < this.EndTime.AddDays(1.0);
				bool flag7 = array.Length > 5;
				if (flag7)
				{
					int.TryParse(array[5], out this._orgnum);
				}
				bool flag8 = this.Type == ActivationType.Root;
				if (flag8)
				{
					string domain = Server.Domain;
					bool flag9 = flag && domain.Length < this.Serial.Length;
					if (flag9)
					{
						flag = false;
					}
					bool flag10 = flag && !domain.EndsWith(this.Serial, StringComparison.CurrentCultureIgnoreCase);
					if (flag10)
					{
						flag = false;
					}
					bool flag11 = flag && domain.Length > this.Serial.Length;
					if (flag11)
					{
						bool flag12 = domain.IndexOf(this.Serial) > 0;
						if (flag12)
						{
							bool flag13 = domain.Substring(domain.IndexOf(this.Serial) - 1, 1) != ".";
							if (flag13)
							{
								flag = false;
							}
						}
					}
					bool flag14 = flag;
					if (flag14)
					{
						foreach (string text in this.LimitDomain)
						{
							bool flag15 = string.Equals(this.Serial, text, StringComparison.CurrentCultureIgnoreCase);
							if (flag15)
							{
								flag = false;
								break;
							}
						}
					}
				}
				this.EdtionLevel = ((!flag) ? 0 : this.EdtionLevel);
				this.IsAnalysis = true;
			}
			bool flag16 = flag && this.EdtionLevel != 0;
			if (flag16)
			{
				IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator();
				while (enumerator.MoveNext())
				{
					HttpRuntime.Cache.Remove(Convert.ToString(enumerator.Key));
				}
			}
			return flag;
		}

		// Token: 0x060000D6 RID: 214 RVA: 0x000069FC File Offset: 0x00004BFC
		private DateTime _readDeployTime()
		{
			object obj = License.o;
			DateTime dateTime3;
			lock (obj)
			{
				DateTime dateTime = DateTime.Now;
				string text = Server.MapPath("~/bin/");
				bool flag2 = !string.IsNullOrWhiteSpace(text);
				if (flag2)
				{
					bool flag3 = !Directory.Exists(text);
					if (flag3)
					{
						Directory.CreateDirectory(text);
					}
					string[] directories = Directory.GetDirectories(text, "0*");
					string[] array = directories;
					int i = 0;
					while (i < array.Length)
					{
						string text2 = array[i];
						string text3 = text2.Substring(text2.LastIndexOf("\\") + 1);
						text3 = text3.Replace("!", "+").Replace("-", "/").Replace("_", "\\")
							.Substring(1);
						try
						{
							text3 = this._DecryptActivCode(text3);
							text3 = text3.Substring(0, text3.IndexOf("$"));
							DateTime dateTime2;
							DateTime.TryParse(text3, out dateTime2);
							dateTime = ((dateTime2 < dateTime) ? dateTime2 : dateTime);
						}
						catch
						{
						}
						IL_0100:
						i++;
						continue;
						goto IL_0100;
					}
					bool flag4 = Math.Abs((DateTime.Now - dateTime).TotalSeconds) < 2.0;
					if (flag4)
					{
						string text4 = Activationcode.RegistCode(0, dateTime.ToString());
						text4 = text4.Replace("+", "!").Replace("/", "-").Replace("\\", "_");
						try
						{
							Directory.CreateDirectory(text + text4);
						}
						catch
						{
						}
					}
				}
				dateTime3 = dateTime;
			}
			return dateTime3;
		}

		// Token: 0x060000D7 RID: 215 RVA: 0x00006BFC File Offset: 0x00004DFC
		private string _DecryptActivCode(string inputString)
		{
			string @string;
			try
			{
				byte[] array = new byte[] { 18, 52, 86, 120, 144, 171, 205, 239 };
				byte[] array2 = new byte[inputString.Length];
				string text = "";
				string text2 = "";
				for (int i = 1; i < inputString.Length; i += 2)
				{
					bool flag = i < 16;
					if (!flag)
					{
						text2 += inputString.Substring(i - 1);
						break;
					}
					text += inputString.Substring(i, 1);
					text2 += inputString.Substring(i - 1, 1);
				}
				byte[] bytes = Encoding.UTF8.GetBytes(text.ToLower());
				DESCryptoServiceProvider descryptoServiceProvider = new DESCryptoServiceProvider();
				array2 = Convert.FromBase64String(text2);
				MemoryStream memoryStream = new MemoryStream();
				CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateDecryptor(bytes, array), CryptoStreamMode.Write);
				cryptoStream.Write(array2, 0, array2.Length);
				cryptoStream.FlushFinalBlock();
				Encoding encoding = new UTF8Encoding();
				@string = encoding.GetString(memoryStream.ToArray());
			}
			catch
			{
				throw;
			}
			return @string;
		}

		// Token: 0x04000030 RID: 48
		private int _freeTime = 72;

		// Token: 0x04000039 RID: 57
		private int _orgnum = 0;

		// Token: 0x0400003F RID: 63
		private static License _p;

		// Token: 0x04000040 RID: 64
		private static readonly object _syncLock = new object();

		// Token: 0x04000041 RID: 65
		protected List<string> _fileDependencies = null;

		// Token: 0x04000042 RID: 66
		private static object o = new object();
	}
}
